package net.oschina.simpleplus.erpc.api;

import java.lang.reflect.Method;

import net.sf.cglib.reflect.FastMethod;

public class FastMethodInvoker {

	private final Object obj;
	private final FastMethod fastMethod;
	
	private final ERpc erpc;

	public FastMethodInvoker(Object obj, FastMethod fastMethod) {
		this.obj = obj;
		this.fastMethod = fastMethod;
		erpc = fastMethod.getJavaMethod().getAnnotation(ERpc.class);
	}

	public Object invoke(Object[] params) throws Exception {
		return fastMethod.invoke(obj, params);
	}

	public Method getJavaMethod() {
		return fastMethod.getJavaMethod();
	}

	public ERpc getErpc() {
		return erpc;
	}
}
